<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="GridCommodity.GridCommodityShow" %>
<%@ page import="GridCommodity.GridCommodityDeal" %>
<%@ page import="java.sql.*"%>
<script  language="javascript">
<!-- Begin validation script  
function checkForm(){
	    if(document.form1.ComName2.value==""){
		alert("请输入商品名称！");
		return false;
		}
	    if(document.form1.ConKind2.value=="0"){
		alert("请选择商品类别！");
		return false;
		}
		if(document.form1.ComNum2.value=="")
		{
			alert("输入商品数量！");
		    return false;
		}
		if(document.form1.ComPrice2.value==""){
		alert("请输入商品价格！");
		return false;
		}
		if(document.form1.Recency.value==""){
		alert("请输入新旧程度！");
		return false;
		}
	return true;
	}
-->
</script>
<html>
  <head>
    <title>修改商品信息</title>
  </head>
  
  <body>
  <%
  String path="";
  String GridComID=request.getParameter("DealID");
  GridCommodityShow a=new GridCommodityShow();
  ResultSet rs=a.CalGridCommodity(GridComID);
  GridCommodityDeal GridCommodity=new GridCommodityDeal();
  if(rs.next())
  {
	
	  GridCommodity.setComID(rs.getString(1));
	  GridCommodity.setComName(rs.getString(2));
	  GridCommodity.setConKind(rs.getString(3));
	  GridCommodity.setShowDate(rs.getString(4));
	  GridCommodity.setDescribe(rs.getString(5));
	  GridCommodity.setComImage(rs.getString(6));
	  GridCommodity.setSellCount(rs.getInt(7));
	  GridCommodity.setRemCount(rs.getInt(8));
	  GridCommodity.setViewCount(rs.getInt(9));
	  GridCommodity.setComPrice(rs.getFloat(10));
	  GridCommodity.setComInf(rs.getString(11));
	  GridCommodity.setGridID(rs.getInt(12));
	  GridCommodity.setRecency(rs.getInt(13));
  }
 
  %>
  <FORM METHOD="POST" NAME="form1" ACTION="SaveGridCommodityModify.jsp?path=<%=GridCommodity.getComImage()%>&GridComID=<%=GridCommodity.getComID()%>"
	ENCTYPE="multipart/form-data" onSubmit="return checkForm()">
	 <table width="90%" border="0" cellspacing="1" cellpadding="0" align="center">
	  <tr align=center>
	    <td  nowrap align="left" >修改商品信息
	   	</td>
	  </tr>
	 </table>	  
	  <table  width="90%" border="0" cellspacing="2" cellpadding="0" bgcolor="#FFFBEC" align="center">
	    <tr> 
	      <td width="20%" align="right">商品名称：</td>
	      <td width="80%" > 
	        <input type="text" name="ComName2" size="30" value=<%=GridCommodity.getComName()%>>
	        * </td>
	    </tr>
	    <tr> 
	      <td width="20%" align="right">商品类别：</td>
	        <td width="80%" > 
	        <SELECT id=typeId style="WIDTH: 110px" name="ConKind2"> 
	         <option   value='服装运动' <%if(GridCommodity.getConKind().equals("服装运动")) out.print("selected"); %> >服装运动</option>  
	         <option   value='礼物饰品'  <%if(GridCommodity.getConKind().equals("礼物饰品")) out.print("selected"); %> >礼物饰品</option>  
	         <option   value='图书音像'  <%if(GridCommodity.getConKind().equals("图书音像")) out.print("selected"); %> >图书音像</option>  
	         <option   value='生活用品'  <%if(GridCommodity.getConKind().equals("生活用品")) out.print("selected"); %> >生活用品</option>  
	         <option   value='数码产品'  <%if(GridCommodity.getConKind().equals("数码产品")) out.print("selected"); %> >数码产品</option> 
	         <option   value='电脑周边'  <%if(GridCommodity.getConKind().equals("电脑周边")) out.print("selected"); %> >电脑周边</option>   
	        </SELECT> 
	        * </td>
	    </tr>
	    <tr> 
	      <td width="20%" align="right">商品数量：</td>
	      <td width="80%" > 
	        <input type="text" name="ComNum2" size="30" value=<%=GridCommodity.getRemCount()%>>
	         </td>
	    </tr>
	    <tr>
	      <td width="20%" align="right">上传商品图片：</td>
	      <td width="80%" > 
	      <input name="ComImage1" type="file" id="ComImage1" size="25" maxlength="200" dataType="Require" value=<%=GridCommodity.getComImage()%> msg="选择上传商品图片" />
	       小于20兆*</td>
	    </tr>
	    <tr> 
	      <td width="20%" align="right">商品简介：</td>
	      <td width="80%" > 
	        <textarea type="textarea" name="Describe" size="30" rows=3 cols=24 ><%=GridCommodity.getDescribe()%></textarea>
	         </td>
	    </tr>
	    <tr> 
	      <td width="20%" align="right" >商品价格：</td>
	      <td width="80%" > 
	        <input type="text" name="ComPrice2" size="30" value=<%=GridCommodity.getComPrice()%>>
	        * </td>
	    </tr>
	    </tr>
      <tr> 
      <td width="20%" align="right">新旧程度：</td>
      <td>
          <SELECT id=typeId style="WIDTH: 110px" name="Recency"> 
          <% 
             for(int i=1;i<=10;i++)
             {
          	 out.print( " <option   value= '"+i+"' selected> "+i+" </option> ");
          	 if(i==GridCommodity.getRecency())
          	 {
          		 out.print("selected");
             }
             }
          %>
          </SELECT> 
      成新*</td>
    
    <tr>
	    <tr> 
	      <td width="20%" align="right">备注：</td>
	      <td width="80%" > 
	         <textarea type="textarea" name="ComInf2" size="30" rows=3 cols=24 ><%=GridCommodity.getComInf()%></textarea>
	        </td>
	    </tr>
	  </table>
	<table width="366" border="0" cellspacing="2" cellpadding="0" align="left">
	
	    <tr align="left"> 
	      <td colspan="2" height="12" align="right"> 
	        <input type="submit" value="提交">
	      </td>
	      <td colspan="2" height="12" align="center"> 
	        <input type="reset" value="重置">
	      </td>
	    </tr>
	  </table>
	</FORM>
  </body>
</html>